package com.hht.toolanduilibs.wb

import android.content.ComponentName
import android.content.Context
import android.content.Intent
import com.hht.toolanduilibs.ConfigurationBean
import com.hht.toolanduilibs.sendBroadCastExt
import com.hht.toolanduilibs.startActivityExt
import java.io.File


/**
 * Author:chen'hu
 * Time:2024/9/10 15:10
 * Description:This is IstWhiteBoard
 */
class IstWhiteBoard(
    configurationBean: ConfigurationBean,
    private val mContext: Context,
) : WhiteBoardImp(configurationBean) {

    override fun sendPicturesToWhiteBoard(file: File?):Boolean {
      return  mContext.startActivityExt {
            setClassName(whiteBoardBean.pkgName, whiteBoardBean.className)
            putExtra(whiteBoardBean.putKey, file?.path)
            putExtra("position", intArrayOf(960, 540))
        }
    }

    override fun openWhiteBoard():Boolean {
       return mContext.startActivityExt {
            component = ComponentName(whiteBoardBean.pkgName, whiteBoardBean.className)
        }
    }

    override fun openAnnotation():Boolean {
       return mContext.sendBroadCastExt {
            action = annotationBean.action ?: "com.ist.START_ANNOTATION"
            setPackage(annotationBean.pkgName)
            addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
            addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
        }
    }
}